package com.sixbro.shiro.controller;

import com.sixbro.shiro.common.annotation.Log;
import com.sixbro.shiro.common.utils.ApiResult;
import com.sixbro.shiro.domain.vo.request.UserRoleOperationRequestVO;
import com.sixbro.shiro.service.rbac.UserRoleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * <p>
 *
 * </p>
 *
 * @Author: Mr.Lu
 * @Since: 2020/6/19 15:54
 */
@RequestMapping("/sys")
@RestController
@Api(tags = "组织管理-用户和角色关联接口")
public class UserRoleController {
    @Autowired
    private UserRoleService userRoleService;

    @PostMapping("/user/role")
    @ApiOperation(value = "修改或者新增用户角色接口")
    @Log(title = "用户和角色关联接口", action = "修改或者新增用户角色")
    public ApiResult operationUserRole(@RequestBody @Valid UserRoleOperationRequestVO vo) {
        userRoleService.addUserRoleInfo(vo);
        return ApiResult.success();
    }
}
